import { Controller, Delete, Get, Param, Query } from '@nestjs/common'
import { ApiTags } from '@nestjs/swagger'
import { ListPageWheelRecordDto } from './dto/wheel-record.dto'
import { WheelRecordService } from './wheel-record.service'

@ApiTags('后台/二期/抽奖记录')
@Controller('admin/wheel_record')
export class WheelRecordController {
  constructor(private readonly wheelRecordService: WheelRecordService) {}

  /**
   * 获取抽奖记录
   */
  @Get()
  page(@Query() query: ListPageWheelRecordDto) {
    const { pageNo, pageSize, ...rest } = query
    return this.wheelRecordService.findPage({ pageNo, pageSize, where: rest, relations: ['wheelPrize'] })
  }

  /**
   * 删除抽奖记录
   */
  @Delete(':wheelRecordId')
  delete(@Param() id: number) {
    return this.wheelRecordService.delete(id)
  }
}
